<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>数组的解构赋值</title>
		<script>
			window.onload=function(){
				let [a, b, c] = [1, 2, 3];
				console.log('a='+a);
				console.log('b='+b);
				console.log('c='+c);
				let [foo, [[bar], baz]] = [1, [[2], 3]];
				console.log('foo='+foo);
				console.log('bar='+bar);
				console.log('baz='+baz);
				let [x1, , y1] = [1, 2, 3];
				console.log('x1='+x1);
				console.log('y='+y1);
				let [head, ...tail] = [1, 2, 3, 4];
				console.log('head='+head);
				console.log('tail='+tail);
				let [x2, y2] = ['a'];
				console.log('x2='+x2);
				console.log('y2='+y2);
				let [d=0,e=1,f=2]=[1,undefined];
				console.log('d='+d);
				console.log('e='+e);
				console.log('f='+f);
				let [g,h,i] = 'hello';	
				console.log('g='+g);
				console.log('h='+h);
				console.log('i='+i);
				
			}
		</script>
	</head>
	<body>
	</body>
</html>
